﻿using System;
using System.Collections.Generic;
using System.Text;
using Pixysoft.Weblications.Sango.Protocol.building;
using Pixysoft.Framework.Reflection;
using Pixysoft.Weblications.Sango.Formular;
using Pixysoft.Weblications.Sango.Environment;

namespace Pixysoft.Weblications.Sango.Protocol
{
    class UsrBuildingFacade
    {
        public static List<building_building> ToBuildings(List<Entities.Usr_Building> orms, Entities.Usr_Activity activity)
        {
            List<building_building> list = new List<building_building>();

            foreach (Entities.Usr_Building orm in orms)
            {
                building_building body = ReflectionManager.CreatePojo<building_building>();
                Entities.Cti_Building sys = CityBuildingHelper.searchBuilding(orm.Buildingtypecode);
                list.Add(body);

                body.buildingname = sys.Buildingname;
                body.buildingtypecode = orm.Buildingtypecode;
                body.buildinglevel = orm.Buildinglevel;
                body.cashvalue = BuildingFormular.getLevelupCashprice(orm);
                body.cooltime = BuildingFormular.getLevelupCoolingTime(orm, activity);

            }

            return list;
        }
    }
}
